<?php


abstract class BaseCmsMemberOrderDetail extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $detail_id;


	
	protected $order_id;


	
	protected $product_id;


	
	protected $categories_id;


	
	protected $categories_name;


	
	protected $categories_name_cn;


	
	protected $categories_desc;


	
	protected $categories_desc_cn;


	
	protected $product_code;


	
	protected $product_name;


	
	protected $product_desc;


	
	protected $product_short_desc;


	
	protected $product_name_cn;


	
	protected $product_desc_cn;


	
	protected $product_short_desc_cn;


	
	protected $product_photo;


	
	protected $qty;


	
	protected $price;


	
	protected $price2;


	
	protected $remarks;


	
	protected $status_code;


	
	protected $created_by;


	
	protected $created_on;


	
	protected $updated_by;


	
	protected $updated_on;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getDetailId()
	{

		return $this->detail_id;
	}

	
	public function getOrderId()
	{

		return $this->order_id;
	}

	
	public function getProductId()
	{

		return $this->product_id;
	}

	
	public function getCategoriesId()
	{

		return $this->categories_id;
	}

	
	public function getCategoriesName()
	{

		return $this->categories_name;
	}

	
	public function getCategoriesNameCn()
	{

		return $this->categories_name_cn;
	}

	
	public function getCategoriesDesc()
	{

		return $this->categories_desc;
	}

	
	public function getCategoriesDescCn()
	{

		return $this->categories_desc_cn;
	}

	
	public function getProductCode()
	{

		return $this->product_code;
	}

	
	public function getProductName()
	{

		return $this->product_name;
	}

	
	public function getProductDesc()
	{

		return $this->product_desc;
	}

	
	public function getProductShortDesc()
	{

		return $this->product_short_desc;
	}

	
	public function getProductNameCn()
	{

		return $this->product_name_cn;
	}

	
	public function getProductDescCn()
	{

		return $this->product_desc_cn;
	}

	
	public function getProductShortDescCn()
	{

		return $this->product_short_desc_cn;
	}

	
	public function getProductPhoto()
	{

		return $this->product_photo;
	}

	
	public function getQty()
	{

		return $this->qty;
	}

	
	public function getPrice()
	{

		return $this->price;
	}

	
	public function getPrice2()
	{

		return $this->price2;
	}

	
	public function getRemarks()
	{

		return $this->remarks;
	}

	
	public function getStatusCode()
	{

		return $this->status_code;
	}

	
	public function getCreatedBy()
	{

		return $this->created_by;
	}

	
	public function getCreatedOn($format = 'Y-m-d H:i:s')
	{

		if ($this->created_on === null || $this->created_on === '') {
			return null;
		} elseif (!is_int($this->created_on)) {
						$ts = strtotime($this->created_on);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [created_on] as date/time value: " . var_export($this->created_on, true));
			}
		} else {
			$ts = $this->created_on;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getUpdatedBy()
	{

		return $this->updated_by;
	}

	
	public function getUpdatedOn($format = 'Y-m-d H:i:s')
	{

		if ($this->updated_on === null || $this->updated_on === '') {
			return null;
		} elseif (!is_int($this->updated_on)) {
						$ts = strtotime($this->updated_on);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [updated_on] as date/time value: " . var_export($this->updated_on, true));
			}
		} else {
			$ts = $this->updated_on;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function setDetailId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->detail_id !== $v) {
			$this->detail_id = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::DETAIL_ID;
		}

	} 

	
	public function setOrderId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->order_id !== $v) {
			$this->order_id = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::ORDER_ID;
		}

	} 

	
	public function setProductId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->product_id !== $v) {
			$this->product_id = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::PRODUCT_ID;
		}

	} 

	
	public function setCategoriesId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->categories_id !== $v) {
			$this->categories_id = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::CATEGORIES_ID;
		}

	} 

	
	public function setCategoriesName($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->categories_name !== $v) {
			$this->categories_name = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::CATEGORIES_NAME;
		}

	} 

	
	public function setCategoriesNameCn($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->categories_name_cn !== $v) {
			$this->categories_name_cn = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::CATEGORIES_NAME_CN;
		}

	} 

	
	public function setCategoriesDesc($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->categories_desc !== $v) {
			$this->categories_desc = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::CATEGORIES_DESC;
		}

	} 

	
	public function setCategoriesDescCn($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->categories_desc_cn !== $v) {
			$this->categories_desc_cn = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::CATEGORIES_DESC_CN;
		}

	} 

	
	public function setProductCode($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->product_code !== $v) {
			$this->product_code = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::PRODUCT_CODE;
		}

	} 

	
	public function setProductName($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->product_name !== $v) {
			$this->product_name = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::PRODUCT_NAME;
		}

	} 

	
	public function setProductDesc($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->product_desc !== $v) {
			$this->product_desc = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::PRODUCT_DESC;
		}

	} 

	
	public function setProductShortDesc($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->product_short_desc !== $v) {
			$this->product_short_desc = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::PRODUCT_SHORT_DESC;
		}

	} 

	
	public function setProductNameCn($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->product_name_cn !== $v) {
			$this->product_name_cn = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::PRODUCT_NAME_CN;
		}

	} 

	
	public function setProductDescCn($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->product_desc_cn !== $v) {
			$this->product_desc_cn = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::PRODUCT_DESC_CN;
		}

	} 

	
	public function setProductShortDescCn($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->product_short_desc_cn !== $v) {
			$this->product_short_desc_cn = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::PRODUCT_SHORT_DESC_CN;
		}

	} 

	
	public function setProductPhoto($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->product_photo !== $v) {
			$this->product_photo = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::PRODUCT_PHOTO;
		}

	} 

	
	public function setQty($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->qty !== $v) {
			$this->qty = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::QTY;
		}

	} 

	
	public function setPrice($v)
	{

		if ($this->price !== $v) {
			$this->price = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::PRICE;
		}

	} 

	
	public function setPrice2($v)
	{

		if ($this->price2 !== $v) {
			$this->price2 = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::PRICE2;
		}

	} 

	
	public function setRemarks($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->remarks !== $v) {
			$this->remarks = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::REMARKS;
		}

	} 

	
	public function setStatusCode($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->status_code !== $v) {
			$this->status_code = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::STATUS_CODE;
		}

	} 

	
	public function setCreatedBy($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->created_by !== $v) {
			$this->created_by = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::CREATED_BY;
		}

	} 

	
	public function setCreatedOn($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [created_on] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->created_on !== $ts) {
			$this->created_on = $ts;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::CREATED_ON;
		}

	} 

	
	public function setUpdatedBy($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->updated_by !== $v) {
			$this->updated_by = $v;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::UPDATED_BY;
		}

	} 

	
	public function setUpdatedOn($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [updated_on] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->updated_on !== $ts) {
			$this->updated_on = $ts;
			$this->modifiedColumns[] = CmsMemberOrderDetailPeer::UPDATED_ON;
		}

	} 

	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->detail_id = $rs->getInt($startcol + 0);

			$this->order_id = $rs->getInt($startcol + 1);

			$this->product_id = $rs->getInt($startcol + 2);

			$this->categories_id = $rs->getInt($startcol + 3);

			$this->categories_name = $rs->getString($startcol + 4);

			$this->categories_name_cn = $rs->getString($startcol + 5);

			$this->categories_desc = $rs->getString($startcol + 6);

			$this->categories_desc_cn = $rs->getString($startcol + 7);

			$this->product_code = $rs->getString($startcol + 8);

			$this->product_name = $rs->getString($startcol + 9);

			$this->product_desc = $rs->getString($startcol + 10);

			$this->product_short_desc = $rs->getString($startcol + 11);

			$this->product_name_cn = $rs->getString($startcol + 12);

			$this->product_desc_cn = $rs->getString($startcol + 13);

			$this->product_short_desc_cn = $rs->getString($startcol + 14);

			$this->product_photo = $rs->getString($startcol + 15);

			$this->qty = $rs->getInt($startcol + 16);

			$this->price = $rs->getFloat($startcol + 17);

			$this->price2 = $rs->getFloat($startcol + 18);

			$this->remarks = $rs->getString($startcol + 19);

			$this->status_code = $rs->getString($startcol + 20);

			$this->created_by = $rs->getInt($startcol + 21);

			$this->created_on = $rs->getTimestamp($startcol + 22, null);

			$this->updated_by = $rs->getInt($startcol + 23);

			$this->updated_on = $rs->getTimestamp($startcol + 24, null);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 25; 
		} catch (Exception $e) {
			throw new PropelException("Error populating CmsMemberOrderDetail object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(CmsMemberOrderDetailPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			CmsMemberOrderDetailPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
    if ($this->isNew() && !$this->isColumnModified(CmsMemberOrderDetailPeer::CREATED_ON))
    {
      $this->setCreatedOn(time());
    }

    if ($this->isModified() && !$this->isColumnModified(CmsMemberOrderDetailPeer::UPDATED_ON))
    {
      $this->setUpdatedOn(time());
    }

		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(CmsMemberOrderDetailPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 
		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


			
			if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = CmsMemberOrderDetailPeer::doInsert($this, $con);
					$affectedRows += 1; 
										 
										 

					$this->setDetailId($pk);  

					$this->setNew(false);
				} else {
					$affectedRows += CmsMemberOrderDetailPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 

	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = CmsMemberOrderDetailPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}



			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = CmsMemberOrderDetailPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getDetailId();
				break;
			case 1:
				return $this->getOrderId();
				break;
			case 2:
				return $this->getProductId();
				break;
			case 3:
				return $this->getCategoriesId();
				break;
			case 4:
				return $this->getCategoriesName();
				break;
			case 5:
				return $this->getCategoriesNameCn();
				break;
			case 6:
				return $this->getCategoriesDesc();
				break;
			case 7:
				return $this->getCategoriesDescCn();
				break;
			case 8:
				return $this->getProductCode();
				break;
			case 9:
				return $this->getProductName();
				break;
			case 10:
				return $this->getProductDesc();
				break;
			case 11:
				return $this->getProductShortDesc();
				break;
			case 12:
				return $this->getProductNameCn();
				break;
			case 13:
				return $this->getProductDescCn();
				break;
			case 14:
				return $this->getProductShortDescCn();
				break;
			case 15:
				return $this->getProductPhoto();
				break;
			case 16:
				return $this->getQty();
				break;
			case 17:
				return $this->getPrice();
				break;
			case 18:
				return $this->getPrice2();
				break;
			case 19:
				return $this->getRemarks();
				break;
			case 20:
				return $this->getStatusCode();
				break;
			case 21:
				return $this->getCreatedBy();
				break;
			case 22:
				return $this->getCreatedOn();
				break;
			case 23:
				return $this->getUpdatedBy();
				break;
			case 24:
				return $this->getUpdatedOn();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = CmsMemberOrderDetailPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getDetailId(),
			$keys[1] => $this->getOrderId(),
			$keys[2] => $this->getProductId(),
			$keys[3] => $this->getCategoriesId(),
			$keys[4] => $this->getCategoriesName(),
			$keys[5] => $this->getCategoriesNameCn(),
			$keys[6] => $this->getCategoriesDesc(),
			$keys[7] => $this->getCategoriesDescCn(),
			$keys[8] => $this->getProductCode(),
			$keys[9] => $this->getProductName(),
			$keys[10] => $this->getProductDesc(),
			$keys[11] => $this->getProductShortDesc(),
			$keys[12] => $this->getProductNameCn(),
			$keys[13] => $this->getProductDescCn(),
			$keys[14] => $this->getProductShortDescCn(),
			$keys[15] => $this->getProductPhoto(),
			$keys[16] => $this->getQty(),
			$keys[17] => $this->getPrice(),
			$keys[18] => $this->getPrice2(),
			$keys[19] => $this->getRemarks(),
			$keys[20] => $this->getStatusCode(),
			$keys[21] => $this->getCreatedBy(),
			$keys[22] => $this->getCreatedOn(),
			$keys[23] => $this->getUpdatedBy(),
			$keys[24] => $this->getUpdatedOn(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = CmsMemberOrderDetailPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setDetailId($value);
				break;
			case 1:
				$this->setOrderId($value);
				break;
			case 2:
				$this->setProductId($value);
				break;
			case 3:
				$this->setCategoriesId($value);
				break;
			case 4:
				$this->setCategoriesName($value);
				break;
			case 5:
				$this->setCategoriesNameCn($value);
				break;
			case 6:
				$this->setCategoriesDesc($value);
				break;
			case 7:
				$this->setCategoriesDescCn($value);
				break;
			case 8:
				$this->setProductCode($value);
				break;
			case 9:
				$this->setProductName($value);
				break;
			case 10:
				$this->setProductDesc($value);
				break;
			case 11:
				$this->setProductShortDesc($value);
				break;
			case 12:
				$this->setProductNameCn($value);
				break;
			case 13:
				$this->setProductDescCn($value);
				break;
			case 14:
				$this->setProductShortDescCn($value);
				break;
			case 15:
				$this->setProductPhoto($value);
				break;
			case 16:
				$this->setQty($value);
				break;
			case 17:
				$this->setPrice($value);
				break;
			case 18:
				$this->setPrice2($value);
				break;
			case 19:
				$this->setRemarks($value);
				break;
			case 20:
				$this->setStatusCode($value);
				break;
			case 21:
				$this->setCreatedBy($value);
				break;
			case 22:
				$this->setCreatedOn($value);
				break;
			case 23:
				$this->setUpdatedBy($value);
				break;
			case 24:
				$this->setUpdatedOn($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = CmsMemberOrderDetailPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setDetailId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setOrderId($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setProductId($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setCategoriesId($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setCategoriesName($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setCategoriesNameCn($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setCategoriesDesc($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setCategoriesDescCn($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setProductCode($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setProductName($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setProductDesc($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setProductShortDesc($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setProductNameCn($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setProductDescCn($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setProductShortDescCn($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setProductPhoto($arr[$keys[15]]);
		if (array_key_exists($keys[16], $arr)) $this->setQty($arr[$keys[16]]);
		if (array_key_exists($keys[17], $arr)) $this->setPrice($arr[$keys[17]]);
		if (array_key_exists($keys[18], $arr)) $this->setPrice2($arr[$keys[18]]);
		if (array_key_exists($keys[19], $arr)) $this->setRemarks($arr[$keys[19]]);
		if (array_key_exists($keys[20], $arr)) $this->setStatusCode($arr[$keys[20]]);
		if (array_key_exists($keys[21], $arr)) $this->setCreatedBy($arr[$keys[21]]);
		if (array_key_exists($keys[22], $arr)) $this->setCreatedOn($arr[$keys[22]]);
		if (array_key_exists($keys[23], $arr)) $this->setUpdatedBy($arr[$keys[23]]);
		if (array_key_exists($keys[24], $arr)) $this->setUpdatedOn($arr[$keys[24]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(CmsMemberOrderDetailPeer::DATABASE_NAME);

		if ($this->isColumnModified(CmsMemberOrderDetailPeer::DETAIL_ID)) $criteria->add(CmsMemberOrderDetailPeer::DETAIL_ID, $this->detail_id);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::ORDER_ID)) $criteria->add(CmsMemberOrderDetailPeer::ORDER_ID, $this->order_id);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::PRODUCT_ID)) $criteria->add(CmsMemberOrderDetailPeer::PRODUCT_ID, $this->product_id);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::CATEGORIES_ID)) $criteria->add(CmsMemberOrderDetailPeer::CATEGORIES_ID, $this->categories_id);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::CATEGORIES_NAME)) $criteria->add(CmsMemberOrderDetailPeer::CATEGORIES_NAME, $this->categories_name);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::CATEGORIES_NAME_CN)) $criteria->add(CmsMemberOrderDetailPeer::CATEGORIES_NAME_CN, $this->categories_name_cn);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::CATEGORIES_DESC)) $criteria->add(CmsMemberOrderDetailPeer::CATEGORIES_DESC, $this->categories_desc);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::CATEGORIES_DESC_CN)) $criteria->add(CmsMemberOrderDetailPeer::CATEGORIES_DESC_CN, $this->categories_desc_cn);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::PRODUCT_CODE)) $criteria->add(CmsMemberOrderDetailPeer::PRODUCT_CODE, $this->product_code);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::PRODUCT_NAME)) $criteria->add(CmsMemberOrderDetailPeer::PRODUCT_NAME, $this->product_name);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::PRODUCT_DESC)) $criteria->add(CmsMemberOrderDetailPeer::PRODUCT_DESC, $this->product_desc);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::PRODUCT_SHORT_DESC)) $criteria->add(CmsMemberOrderDetailPeer::PRODUCT_SHORT_DESC, $this->product_short_desc);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::PRODUCT_NAME_CN)) $criteria->add(CmsMemberOrderDetailPeer::PRODUCT_NAME_CN, $this->product_name_cn);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::PRODUCT_DESC_CN)) $criteria->add(CmsMemberOrderDetailPeer::PRODUCT_DESC_CN, $this->product_desc_cn);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::PRODUCT_SHORT_DESC_CN)) $criteria->add(CmsMemberOrderDetailPeer::PRODUCT_SHORT_DESC_CN, $this->product_short_desc_cn);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::PRODUCT_PHOTO)) $criteria->add(CmsMemberOrderDetailPeer::PRODUCT_PHOTO, $this->product_photo);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::QTY)) $criteria->add(CmsMemberOrderDetailPeer::QTY, $this->qty);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::PRICE)) $criteria->add(CmsMemberOrderDetailPeer::PRICE, $this->price);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::PRICE2)) $criteria->add(CmsMemberOrderDetailPeer::PRICE2, $this->price2);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::REMARKS)) $criteria->add(CmsMemberOrderDetailPeer::REMARKS, $this->remarks);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::STATUS_CODE)) $criteria->add(CmsMemberOrderDetailPeer::STATUS_CODE, $this->status_code);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::CREATED_BY)) $criteria->add(CmsMemberOrderDetailPeer::CREATED_BY, $this->created_by);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::CREATED_ON)) $criteria->add(CmsMemberOrderDetailPeer::CREATED_ON, $this->created_on);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::UPDATED_BY)) $criteria->add(CmsMemberOrderDetailPeer::UPDATED_BY, $this->updated_by);
		if ($this->isColumnModified(CmsMemberOrderDetailPeer::UPDATED_ON)) $criteria->add(CmsMemberOrderDetailPeer::UPDATED_ON, $this->updated_on);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(CmsMemberOrderDetailPeer::DATABASE_NAME);

		$criteria->add(CmsMemberOrderDetailPeer::DETAIL_ID, $this->detail_id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getDetailId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setDetailId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setOrderId($this->order_id);

		$copyObj->setProductId($this->product_id);

		$copyObj->setCategoriesId($this->categories_id);

		$copyObj->setCategoriesName($this->categories_name);

		$copyObj->setCategoriesNameCn($this->categories_name_cn);

		$copyObj->setCategoriesDesc($this->categories_desc);

		$copyObj->setCategoriesDescCn($this->categories_desc_cn);

		$copyObj->setProductCode($this->product_code);

		$copyObj->setProductName($this->product_name);

		$copyObj->setProductDesc($this->product_desc);

		$copyObj->setProductShortDesc($this->product_short_desc);

		$copyObj->setProductNameCn($this->product_name_cn);

		$copyObj->setProductDescCn($this->product_desc_cn);

		$copyObj->setProductShortDescCn($this->product_short_desc_cn);

		$copyObj->setProductPhoto($this->product_photo);

		$copyObj->setQty($this->qty);

		$copyObj->setPrice($this->price);

		$copyObj->setPrice2($this->price2);

		$copyObj->setRemarks($this->remarks);

		$copyObj->setStatusCode($this->status_code);

		$copyObj->setCreatedBy($this->created_by);

		$copyObj->setCreatedOn($this->created_on);

		$copyObj->setUpdatedBy($this->updated_by);

		$copyObj->setUpdatedOn($this->updated_on);


		$copyObj->setNew(true);

		$copyObj->setDetailId(NULL); 

	}

	
	public function copy($deepCopy = false)
	{
		
		$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new CmsMemberOrderDetailPeer();
		}
		return self::$peer;
	}

} 